// miniprogram/pre_loadModules/orderModule/pages/orderPayment/orderPayment.js
import { getorderByorderSn } from '@/miniprogram/pre_loadModules/orderModule/API/order'
Page({

   /**
    * 页面的初始数据
    */
   data: {
      orderSn: null, id: 0, min: 0, sec: 0, height: '',
      orderInfo: null,
      payPath: [
         { id: 1, icon: '/static/icons/wxpay.png', title: "微信", desc: "微信移动端支付", checked: true },
         // { id: 2, icon: '/static/icons/支付宝.png', title: "支付宝", desc: "支付宝用户支付", checked: false }
      ]
   },

   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
      let { orderSn, id } = options
      this.setData({
         orderSn,
         id
      })
   },

   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady() {

   },

   /**
    * 生命周期函数--监听页面显示
    */
   onShow() {
      let { height } = this.data
      height = wx.getWindowInfo().windowHeight
      this.getorderByorderSnFun()
      let temp =( height - 100 ) + 'px'
      this.setData({
         height:temp
      })
      console.log("height:",height);
   },
   radiochange(e) {
      console.log(e);
   },

   comfirmPaybtn(){

   },

   async getorderByorderSnFun() {
      let { orderInfo, orderSn } = this.data
      let data = {}
      data.orderSn = orderSn
      let res = await getorderByorderSn(data)
      orderInfo = res.data.data
      orderInfo.payAmount = orderInfo.payAmount.toFixed(2)
      this.setData({
         orderInfo
      })
   },
   /**
    * 生命周期函数--监听页面隐藏
    */
   onHide() {

   },

   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload() {

   },

   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh() {

   },

   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom() {

   },

   /**
    * 用户点击右上角分享
    */
   onShareAppMessage() {

   }
})